package com.ruoyi.web.controller.task;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.task.domain.TaskExamine;
import com.ruoyi.task.service.ITaskExamineService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 任务审核详情Controller
 * 
 * @author ruoyi
 * @date 2025-05-17
 */
@RestController
@RequestMapping("/system/examine")
public class TaskExamineController extends BaseController
{
    @Autowired
    private ITaskExamineService taskExamineService;

    /**
     * 查询任务审核详情列表
     */
  //  @PreAuthorize("@ss.hasPermi('system:examine:list')")
    @GetMapping("/list")
    public TableDataInfo list(TaskExamine taskExamine)
    {
        startPage();
        List<TaskExamine> list = taskExamineService.selectTaskExamineList(taskExamine);
        return getDataTable(list);
    }

    /**
     * 导出任务审核详情列表
     */
   // @PreAuthorize("@ss.hasPermi('system:examine:export')")
    @Log(title = "任务审核详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TaskExamine taskExamine)
    {
        List<TaskExamine> list = taskExamineService.selectTaskExamineList(taskExamine);
        ExcelUtil<TaskExamine> util = new ExcelUtil<TaskExamine>(TaskExamine.class);
        util.exportExcel(response, list, "任务审核详情数据");
    }

    /**
     * 获取任务审核详情详细信息
     */
   // @PreAuthorize("@ss.hasPermi('system:examine:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(taskExamineService.selectTaskExamineById(id));
    }

    /**
     * 新增任务审核详情
     */
  //  @PreAuthorize("@ss.hasPermi('system:examine:add')")
    @Log(title = "任务审核详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TaskExamine taskExamine)
    {
        return toAjax(taskExamineService.insertTaskExamine(taskExamine));
    }

    /**
     * 修改任务审核详情
     */
   // @PreAuthorize("@ss.hasPermi('system:examine:edit')")
    @Log(title = "任务审核详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TaskExamine taskExamine)
    {
        return toAjax(taskExamineService.updateTaskExamine(taskExamine));
    }

    /**
     * 删除任务审核详情
     */
   // @PreAuthorize("@ss.hasPermi('system:examine:remove')")
    @Log(title = "任务审核详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(taskExamineService.deleteTaskExamineByIds(ids));
    }
}
